//
// Created by twetec on 25-6-22.
//

#ifndef NETWORK_PROBER_DATABASE_MEMORY_DB_MODEL_H
#define NETWORK_PROBER_DATABASE_MEMORY_DB_MODEL_H

namespace network_prober::database
{

enum ProbeNetProtocol
{
    HTTPS = 1,
    ICMP,
    TCP,
    UDP,
    POST_GRE_SQL,
    SQL_SERVER,
    MY_SQL,
    MONGO_DB,
    REDIS,
    HTTP
};

/**
 *  观测目标
 */
struct  ObservedTargetModel
{
    std::string id; // 表记录标识
    std::string uuid;
    std::string interface;
    std::string address;
    std::uint32_t port;
    std::uint32_t protocol;
    std::string responseCode;
    bool ignoreTsl;    // 目标地址
    std::string requestMethod; //  目标端口
    std::string requestHeader;  // 地址类型 ipv4/ipv6
    std::string requestBody;
    bool responseChallenge;
    std::string userName;
    std::string password;
    std::string databaseName;
    std::string queryStatement;
    bool matchCondition{false};
    std::string keyWords{""};
};

enum BackupProtocol
{
    TEL_NET = 1,
    SSH = 2
};

/**
 * 备份目标
 */
struct DeviceModel
{
    std::string id;
    std::string uuid;
    std::string interface;  // 网口名称
    std::string address;        // ip地址
    std::string backupDate;     // 备份时间
    std::string command;        // 备份命令
    std::uint32_t protocol;     // 1:TeInet 2: SSH
    std::string account;        // 账号
    std::string password;       // 密码
    std::string privilegedPassword; // 特权密码
    std::uint64_t port;    // 端口
};

/**
 * 观测任务
 */
struct ProbeTaskModel
{
    std::string id; // 表记录标识
    std::string uuid;
    std::string interface;
    std::string address;
    std::uint32_t port;
    std::uint32_t protocol;
    std::string responseCode;
    bool ignoreTsl;    // 目标地址
    std::string requestMethod; //  目标端口
    std::string requestHeader;  // 地址类型 ipv4/ipv6
    std::string requestBody;
    bool responseChallenge;
    std::string userName;
    std::string password;
    std::string databaseName;
    std::string queryStatement;
    bool matchCondition{false};
    std::string keyWords{""};

    friend std::ostream& operator<<(std::ostream& out, const ProbeTaskModel& model);
};

/**
 * 备份任务
 */
struct BackupTaskModel
{
    std::string id;
    std::string uuid;
    std::string interface;  // 网口名称
    std::string address;        // ip地址
    std::string backupDate;     // 备份时间
    std::string command;        // 备份命令
    std::uint32_t protocol;     // 1:TeInet 2: SSH
    std::string account;        // 账号
    std::string password;       // 密码
    std::string privilegedPassword; // 特权密码
    std::uint64_t port;    // 端口
};

/**
 * 备份数据
 */
struct BackupTaskResultModel
{
    std::string id;
    std::string uuid;
    std::string backupData;  // 备份数据
    std::int64_t backupDate;    // 备份时间
};


}

#endif //NETWORK_PROBER_DATABASE_MEMORY_DB_MODEL_H
